import {rolelist} from "@/request/api.js"
export default {
    state:{
        roleList:[]
    },
    getters:{
        get_roleList(state){
            return state.roleList
        }
    },
    mutations:{
        mutation_roleList(state,payload){
            state.roleList = payload
        }
    },
    actions:{
        //发起数据请求
        async action_roleList({commit}){
            try {
                let res = await rolelist();
                if(res.code == 200){
                    //修改值
                    commit("mutation_roleList",res.list)
                }

            }catch(err){
                console.log(err);
            }
        }
    },
    namespaced:true
}